﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using DaphneTranslatorWPF.Mvvm;

namespace DaphneTranslatorWPF.ViewModel
{
    public enum enumRenamingStrategy { RenameAllFilesInGroup, CreateNewGroup };

    /// <summary>
    /// View model for file properties dialog
    /// </summary>
    public class FilePropertiesViewModel: INotifyPropertyChanged
    {
        private bool m_bAllFilesInGroupSelected;
        private bool m_bCreateNewGroupSelected;
        private DelegateCommand<object> SaveDataCommand;

        public FilePropertiesViewModel()
        {
            PathSelectionViewModel = new PathSelectionViewModel();
            PathSelectionViewModel.EnterRelativePath = true;

            SaveDataCommand = new DelegateCommand<object>(SaveDataHandler);
        }

        public PathSelectionViewModel PathSelectionViewModel
        { get; set; }


        public string FileName
        { get; set; }

        public enumRenamingStrategy RenamingStrategy
        {
            get
            {
                if (IsNewGroupSelected)
                    return enumRenamingStrategy.CreateNewGroup;
                else
                    return enumRenamingStrategy.RenameAllFilesInGroup;
            }
            set
            {
                if(value == enumRenamingStrategy.RenameAllFilesInGroup)
                {
                    IsAllFilesInGroupSelected = true;
                    IsNewGroupSelected = false;
                }
                else
                {
                    IsAllFilesInGroupSelected = false;
                    IsNewGroupSelected = true;
                }
            }
        }

        public bool IsAllFilesInGroupSelected
        {
            get
            {
                return m_bAllFilesInGroupSelected;
            }
            set
            {
                m_bAllFilesInGroupSelected = value;
            }
        }

        public bool IsNewGroupSelected
        {
            get
            {
                return m_bCreateNewGroupSelected;
            }
            set
            {
                m_bCreateNewGroupSelected = value;
            }
        }

        protected void SaveDataHandler(object obj)
        {
        }


        public event PropertyChangedEventHandler PropertyChanged;
    }
}
